package cn.com.guanying.android.ui.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.SpinnerAdapter;
import android.widget.AdapterView.OnItemClickListener;
import cn.com.guanying.R;
import cn.com.guanying.android.ui.adapter.ImageAdapter;
/**
 * 首页热门横向滚动图片
 * @author zhangbing
 *
 */
public class HomeHeaderView{
	
	public int mImageCount=1;
	
	public ViewFlow mViewflow;
	
	public FlowIndicator mFlowIndicator;
	
	public ImageAdapter mImageAdapter;
	
	FrameLayout frameLayout;
	
	/**
	 * 
	 * @param context
	 * @param listener 处理当点击图片的时候做出响应处理
	 */
	public HomeHeaderView(Context context,OnItemClickListener listener) {
		frameLayout = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.widget_circle_layout, null);
		mViewflow = (ViewFlow)frameLayout.findViewById(R.id.viewflow);
		mFlowIndicator = (FlowIndicator)frameLayout.findViewById(R.id.viewflowindic);
		mFlowIndicator.setViewFlow(mViewflow);
		mViewflow.setOnItemClickListener(listener);
//		mViewflow.setFlowIndicator(mFlowIndicator);
		
	}
	
	public HomeHeaderView(Context context)
	{
		this(context,null);
	}
	
	public View getView()
	{
		return frameLayout;
	}
	/**
	 * 设置图片切换view的adapter
	 * @param adapter
	 */
	public void setAdapter(SpinnerAdapter adapter){
		mViewflow.setAdapter(adapter);
	}
	public void setCount(int count)
	{
		mImageCount = count;
	}

}
